Skip to content

Conversation

@clydin
Copy link
Member

@clydin clydin commented Jan 15, 2026

When async-await is disabled (e.g., in Zone.js applications) and the build target is ES2019 or higher, esbuild may incorrectly remove the catch binding of a downleveled for await...of loop during minification.

This change explicitly disables the optional-catch-binding feature in esbuild when async-await support is disabled, forcing esbuild to retain the catch binding and avoiding the minification bug.

Closes #32298

…eveled for-await

When `async-await` is disabled (e.g., in Zone.js applications) and the build target is ES2019 or higher, esbuild may incorrectly remove the catch binding of a downleveled `for await...of` loop during minification.

This change explicitly disables the `optional-catch-binding` feature in esbuild when `async-await` support is disabled, forcing esbuild to retain the catch binding and avoiding the minification bug.

A new integration test has been added to verify that the catch binding is preserved in the optimized output.
@clydin clydin added the target: patch This PR is targeted for the next patch release label Jan 15, 2026
@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Jan 15, 2026
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Jan 16, 2026
@clydin clydin merged commit d87f243 into angular:main Jan 16, 2026
38 checks passed
@clydin
Copy link
Member Author

clydin commented Jan 16, 2026

This PR was merged into the repository. The changes were merged into the following branches:

@clydin clydin deleted the application/esbuild-for-await branch January 16, 2026 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/build target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Builder produces wrong minified code.

2 participants